Restore concise schema DSL with verb helpers, plain runtype responses, and path param validation#3
Restore concise schema DSL with verb helpers, plain runtype responses, and path param validation#3
Conversation
|
@copilot Should endpoint keys in user-facing schemas include a leading slash ('users/{id}' vs '/users/{id}'), or should I normalize both?
Can I assume request/response definitions may be plain runtype-object literals (e.g., { id: String }) and I should auto-wrap them (with Record) for runtime guards?
Is body optional for GET by definition (i.e., disallow bodies for GET/DELETE), or should I just rely on the helpers’ defaults?
|
Co-authored-by: hanc2006 <4517251+hanc2006@users.noreply.github.com>
Co-authored-by: hanc2006 <4517251+hanc2006@users.noreply.github.com>
Co-authored-by: hanc2006 <4517251+hanc2006@users.noreply.github.com>
Co-authored-by: hanc2006 <4517251+hanc2006@users.noreply.github.com>
Co-authored-by: hanc2006 <4517251+hanc2006@users.noreply.github.com>
Co-authored-by: hanc2006 <4517251+hanc2006@users.noreply.github.com>
Implemented: paths now normalize with or without leading slash, request/response objects are auto-wrapped into runtypes, and body is omitted for verbs that don’t allow it. (49d30ea) |
|
@copilot your changes add a lot of issues! The #file:schema.ts as many errors |
Co-authored-by: hanc2006 <4517251+hanc2006@users.noreply.github.com>
|
@copilot The
const schema = {
'users/{id}': GET({
path: { id: Number },
responses: {
200: { name: String },
404: { error: String },
},
}),
}; |
Co-authored-by: hanc2006 <4517251+hanc2006@users.noreply.github.com>
Path params are now inferred and validated: keys are derived from the route template, invalid names like |
pathwhen no params)Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.